<template>
	<app-page>
		<wd-config-provider :theme="theme">
			<view class="container">
				<template v-if="status === 0">
					<view class="img">
						<image src="@/order/static/img/wait.png" mode="aspectFill"></image>
					</view>
					<view class="title">等待处理</view>
					<view class="desc">
						已提交申请，等待平台处理
					</view>
				</template>
				<template v-if="status === 1">
					<view class="img">
						<image src="@/order/static/img/success.png" mode="aspectFill"></image>
					</view>
					<view class="title">售后成功</view>
					<view class="desc">
						根据平台判定，售后成功，费用将会在5个工作日内退还到您的钱包，请注意及时查收
					</view>
				</template>
				<template v-if="status === -1">
					<view class="img">
						<image src="@/order/static/img/failure.png" mode="aspectFill"></image>
					</view>
					<view class="title">售后失败</view>
					<view class="desc"> 平台判定售后失败 </view>
				</template>
			</view>
		</wd-config-provider>
	</app-page>

</template>

<script lang="ts">
	import { defineComponent, ref } from 'vue';
	import { getQueryOrderBackInfo } from "@/api/coop"
	import { onLoad } from '@dcloudio/uni-app';
	import useRouter from '@/hooks/useRouter.ts';
	export default defineComponent({
		name: '',
		setup(props, ctx) {
			const router = useRouter();

			// 日间light、夜间dark主题
			const theme = ref('light');
			const status = ref(1);
			let httpType : any = "coop";
			const httpKey = {
				'coop': 'coo_order_id',
			}
			const getHttp = {
				'coop': getQueryOrderBackInfo,
			}
			onLoad((param : any) => {
				if (param.id) {
					if (param.type) {
						httpType = param.type; // 获取请求类型，例如：imOrder、order等。
					}
					getHttp[httpType]({
						[httpKey[httpType]]: param.id
					}).then((res) => {
						status.value = res.back_status;
					})
				}

			})
			return {
				theme,
				status
			};
		}
	});
</script>
<!-- #ifdef MP-WEIXIN -->
<style lang="less">
	page {
		background-color: #f2f2f2;
	}
</style>
<!-- #endif -->
<style lang="less" scoped>
	page {
		background-color: #f2f2f2;
		padding: 24rpx;
		height: 100%;
		display: flex;
		flex-direction: column;

		.wot-theme-light {
			height: 100%;
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
			flex-direction: column;
		}
	}

	.container {
		background-color: #fff;
		padding: 71rpx 21rpx;
		width: 90%;
		display: flex;
		flex-direction: column;
		align-items: center;
		height: calc(100% - 71rpx - 71rpx);
		margin: 24rpx auto;


		.title {
			font-family: PingFang;
			font-weight: bold;
			font-size: 42rpx;
			color: #000000;
			margin-top: 28rpx;
		}

		.desc {
			font-family: PingFang;
			font-weight: 400;
			font-size: 33rpx;
			color: #000000;
			margin-top: 38rpx;
		}

		.img {
			width: 185.42rpx;
			height: 186.11rpx;
			border-radius: 50%;
			overflow: hidden;
			margin: 0 auto;

			image {
				width: 100%;
				height: 100%;
			}


		}
	}
</style>